/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 8 has an LED connected on most Arduino boards.
// give it a name:
int ledred = 8;
int ledgreen = 7;
int ledyellow = 6;
int ledbutton = 2;
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(ledred, OUTPUT);     
  pinMode(ledgreen, OUTPUT);  
  pinMode(ledyellow, OUTPUT);  
  pinMode(ledbutton, INPUT);
}

// the loop routine runs over and over again forever:
void loop() {
 /* digitalWrite(ledred, HIGH);   // turn the LED Red on (HIGH is the voltage level)
  delay(3000);               // wait for a second
  digitalWrite(ledred, LOW);    // turn the LED Red off by making the voltage LOW
  digitalWrite(ledgreen, HIGH);    // turn the LED Green off by making the voltage HIGH
  delay(3000);               // wait for a second
  digitalWrite(ledgreen, LOW);   // turn the LED Green on (LOW is the voltage level)
    digitalWrite(ledyellow, HIGH);    // turn the LED Yellow off by making the voltage HIGH
  delay(1000);               // wait for a second
 digitalWrite(ledyellow, LOW);   // turn the LED Yellow on (LOW is the voltage level)
 */ if(digitalRead(ledbutton)==HIGH) 
  {
    digitalWrite(ledred, HIGH);
    digitalWrite(ledgreen, LOW);
    digitalWrite(ledyellow, LOW);
  } 
  else 
  {
      digitalWrite(ledred, LOW);
      digitalWrite(ledgreen, HIGH);
      digitalWrite(ledyellow, LOW);
  }
}
/*
//Code for button

// set pin numbers:
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

 variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);     
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
}
*/
